package com.ncloud.billing.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.alibaba.fastjson.JSONObject;
import com.ncloud.billing.entity.Chnl;

@Mapper
public interface ChnlMapper{

	@Select("SELECT chnl_id, chnl_name, chnl_type, parent_id, create_time, create_user, update_time, update_user, remark FROM sys_chnl where parent_id = #{parent_id} ")
	@Results({
		@Result(column="chnl_id",property="chnl_id"),@Result(column="chnl_name",property="chnl_name"),
		@Result(column="chnl_type",property="chnl_type"),@Result(column="parent_id",property="parent_id"),
		@Result(column="create_time",property="create_time"),@Result(column="create_user",property="create_user"),
		@Result(column="update_time",property="update_time"),@Result(column="update_user",property="update_user"),
		@Result(column="remark",property="remark")})
	List<Chnl> getChnlByParentID(Long parent_id);
	@Select("SELECT chnl_id, chnl_name, chnl_type, chnl_level, parent_id, area, email, phone,fax  "
			+ "FROM sys_chnl where chnl_level = #{chnl_level} ")
	@Results({
		@Result(column="chnl_id",property="chnl_id"),@Result(column="chnl_name",property="chnl_name"),
		@Result(column="chnl_type",property="chnl_type"),@Result(column="chnl_level",property="chnl_level"),
		@Result(column="parent_id",property="parent_id"),
		@Result(column="area",property="area"),@Result(column="email",property="email"),
		@Result(column="phone",property="phone"),@Result(column="fax",property="fax")})
	List<JSONObject> getChnlByChnlLevel(String chnl_level);
}
